﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StoreIGet.Applications.Command;
using StoreIModels;

namespace StoreIGet.Controllers
{
    /// <summary>
    /// 分类相册
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SystematicController : ControllerBase
    {
        public readonly IMediator _mediator;
        public SystematicController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<SystematicModel>> GetSystemic(SystematicShowCommand command)
        {
            return await _mediator.Send(command);
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<SystematicModel> BackSystemic(SystematicBackCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
